class Stack {
public:
	static bool cmp(vector<int> a, vector<int> b) {
		if (a[0] == b[0]) {
			return a[1] < b[1];
		} else {
			return a[0] < b[0];
		}
	}
	int getHeight(vector<vector<int>> actors, int n) {
		// 先按照 身高 排序
		sort(actors.begin(), actors.end(), cmp);
		// 然后开始 dp, 找最长递增序列
		int ans = 0;
		int dp[n];
		dp[0] = 1;
		for (int i = 1; i < n; i++) {
			int mx = 0;
			for (int j = 0; j < i; j++) {
				if (actors[j][1] < actors[i][1]) {
					mx = max(mx, dp[j]);
				}
			}
			dp[i] = mx + 1;
			ans = max(ans, dp[i]);
		}
		return ans;
	}
};
